\documentclass[10pt,a4paper]{article} 
\usepackage{ctex} % 中文支持
\usepackage[top=2.5cm, bottom=2.5cm, left=2.5cm, right=2.5cm]{geometry} % 页边距
\usepackage{amsmath, amssymb} % 数学公式与符号
\usepackage{graphicx}
\usepackage{pythonhighlight}
\usepackage{url} 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 插入代码相关宏包
\usepackage{listings}
\usepackage{color}

% 设置列表的样式
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}

\lstdefinestyle{mystyle}{
    backgroundcolor=\color{backcolour},   
    commentstyle=\color{codegreen},
    keywordstyle=\color{magenta},
    numberstyle=\tiny\color{codegray},
    stringstyle=\color{codepurple},
    basicstyle=\ttfamily\footnotesize,
    breakatwhitespace=false,         
    breaklines=true,                 
    captionpos=b,                    
    keepspaces=true,                 
    numbers=left,                    
    numbersep=5pt,                  
    showspaces=false,                
    showstringspaces=false,
    showtabs=false,                  
    tabsize=2
}

\lstset{style=mystyle}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 使表格美观
\usepackage{array}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
%\newcolumntype{N}{@{}m{0pt}@{}}
\setlength\extrarowheight{3pt}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{titling}
\setlength{\droptitle}{-2cm} % 标题上移
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%文档的题目、作者与日期
\author{五六七 }
\title{小行星轨道曲线 }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\maketitle

\begin{abstract}
天文学家要根据观测数据，确定一颗小行星的轨道方程。
\end{abstract}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\setcounter{tocdepth}{2}
%\renewcommand\contentsname{目录}
%
%\renewcommand {\baselinestretch} {1.3}\normalsize 
%\tableofcontents 
%\renewcommand {\baselinestretch} {1.0}\normalsize


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{问题描述}
有一个天文学家在观测太阳系内的一颗小行星。他在轨道平面内，以太阳为原点建立了直角坐标，并测得五个时间点的坐标，数据如表所示。
\begin{table}[ht!]\centering
\caption{小行星观测数据 } \vspace{0.2cm}
\begin{tabular}{|M{1.5cm}|M{1.5cm}|M{1.5cm}|M{1.5cm}|M{1.5cm}|M{1.5cm}|}\hline
坐标 & 1 & 2 & 3 & 4 & 5  \\ \hline 
$x$ & 5.764 & 6.286 & 6.759 & 7.168 & 7.408  \\ \hline 
$y$ & 0.648 & 1.202 & 1.823 & 2.526 & 3.360  \\ \hline 
\end{tabular}
\end{table}

两个坐标轴的单位长度为1个天文单位1AU， 即从地球到太阳的平均距离1.5亿公里。
根据开普勒第一定律，小行星的轨道为椭圆，方程的一般形式为 
\begin{eqnarray}
c_0x^2+c_1xy+c_2y^2+c_3x+c_4y+1=0. 
\label{eq-1}
\end{eqnarray}
根据上述观测数据，估计系数，并画出轨道曲线的图像。
插图是小行星带示意图\footnote{图像来源：\url{https://esahubble.org}. }。

\begin{figure}[ht!]\centering
\includegraphics [height=8cm, width=8cm]{asteroid-belt.jpg}
\caption{小行星带示意图 }
\end{figure}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{建立模型}

将观测数据 $(x_i,y_i), 1\le i\le 5$ 代入椭圆轨道方程，可得下述方程组
\begin{equation}
\left\{
\begin{aligned}
c_0x_1^2 + c_1x_1y_1 + c_2y_1^2 + c_3 x_1 + c_4 y_1  &= -1, \\
c_0x_2^2 + c_1x_2y_2 + c_2y_2^2 + c_3 x_2 + c_4 y_2  &= -1, \\
c_0x_3^2 + c_1x_3y_3 + c_2y_3^2 + c_3 x_3 + c_4 y_3  &= -1, \\
c_0x_4^2 + c_1x_4y_4 + c_2y_4^2 + c_3 x_4 + c_4 y_4  &= -1, \\
c_0x_5^2 + c_1x_5y_5 + c_2y_5^2 + c_3 x_5 + c_4 y_5  &= -1. 
\end{aligned}
\right. 
\end{equation}
将系数 $c_0,c_1,c_2,c_3,c_4$ 看作未知数，可得下述矩阵形式的线性方程组
\begin{eqnarray}
\begin{bmatrix} 
x_1^2 & x_1y_1 & y_1^2 & x_1 & y_1 \\ 
x_2^2 & x_2y_2 & y_2^2 & x_2 & y_2 \\ 
x_3^2 & x_3y_3 & y_3^2 & x_3 & y_3 \\ 
x_4^2 & x_4y_4 & y_4^2 & x_4 & y_4 \\ 
x_5^2 & x_5y_5 & y_5^2 & x_5 & y_5 \\ 
\end{bmatrix} 
\begin{bmatrix} c_0 \\ c_1 \\ c_2 \\ c_3 \\ c_4 \end{bmatrix} 
= \begin{bmatrix} -1 \\ -1 \\ -1 \\ -1 \\ -1 \end{bmatrix}. 
\end{eqnarray}

因为未知数个数与方程个数正好相等，所以直接将系数矩阵求逆，得出线性方程组的解。
如果观测数据超过5组，则可以用最小二乘法求出椭圆方程的五个系数。

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{编程计算}

\lstinputlisting[language=Python]{mme2024-example-7-11.py}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{回答问题}
所求小行星的轨道方程为 
\begin{eqnarray}
0.0508 x^2 -0.0702 xy + 0.0381 y^2 - 0.4531 x + 0.2643 y + 1 = 0.
\end{eqnarray}
轨道图像为
\begin{figure}[ht]\centering
\includegraphics [height=8cm, width=12cm]{mme2024-example-7-11.png}
\caption{小行星运行轨道}
\end{figure}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{另一种方法编程计算}

\lstinputlisting[language=Python]{mme2024-example-7-11-b.py}

\begin{figure}[ht]\centering
\includegraphics [height=8cm, width=12cm]{mme2024-example-7-11-b.png}
\caption{小行星运行轨道的另一种计算结果}
\end{figure}

问题：为什么原点（太阳）在这个椭圆轨道的外面？

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\newpage

%\section{参考文献 }
\begin{thebibliography}{99}
%\bibitem{dingtongren} 丁同仁、李承治，常微分方程教程，高等教育出版社，2022年3月第三版。
\bibitem{sishoukui-2} 司守奎,孙玺菁. \emph{Python数学建模算法与应用}, 国防工业出版社. 2022年1月第1版. 


\end{thebibliography}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\end{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%





